<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="https://cdn.bootcss.com/vue/2.6.10/vue.js"></script>
</head>

<body>
    <div id="root">
        <!-- 通过插槽向子组件传递DOM元素 -->
        <bodycontent>
            <!-- 给插槽取名字 -->
            <div class="header" slot="header">header</div>
            <div class="footer" slot="footer">footer</div>
        </bodycontent>
    </div>
    <script type="text/javascript">
    Vue.component('bodycontent', {
        template: `<div>
						<slot name="header">
							<h1>默认header</h1>
						</slot>
						<div>content</div>
						<slot name="footer"></slot>
				  </div>`
    })
    var vm = new Vue({
        el: "#root"
    })
    </script>
</body>

</html>